pp108 : xpathBusinessObject Property

xpathBusinessObject Property


This is a string that denotes the XPath to thebusinessObject, with respect to thexpathRowDataproperty. ThebusinessObjectis usually the parent element of the business elements (cells). This is a read-only property.

Syntax

Inline HTML

<div cordysType="wcp.library.ui.XGrid">
	        id=XGridID 
         xpathRowData = " "
         xpathBusinessObject = sXPath&gt;
         ...
</div>


Possible Values

Parameter

Description

sXPath

String that denotes a valid XPath to thebusinessObject, with respect to therowData(repetitive node).


Remarks


Consider the following XML response to a request for employees from the Northwind database.

<data>
    <GetEmployeesResponse xmlns="http://schemas.cordys.com/1.0/demo/northwind">
        <tuple>
            <old>
                <Employees>
                    <EmployeeID>1</EmployeeID>
                    <FirstName>Nancy</FirstName>
                    <LastName>Davolio</LastName>
                </Employees>
            </old>
        </tuple>
        <tuple>
            <new>
                <Employees>
                    <EmployeeID>2</EmployeeID>
                    <FirstName>Andrew</FirstName>
                    <LastName>Fuller</LastName>
                </Employees>
            </new>
        </tuple>
    </GetEmployeesResponse>
</data>


The businessObject in this example is<Employees>. The XPath under<tuple>to this businessObject is either new/Employees or old/Employees. In this case use new/Employees when it is available; when this node is not available, use old/Employees.

However, a default namespace (xmlns) is specified on<GetEmployeesResponse>. All child nodes below theGetEmployeesResponsenode inherit this default namespace. You can also specify different namespaces for these nodes.

To obtain a valid XPath expression, a prefix needs to be applied for the namespace. For example, let us usenwdas a prefix ofhttp://schemas.cordys.com/1.0/demo/northwind. This can be done in the Internet Explorer as follows.

[dataXMLDocument].setProperty("SelectionNamespaces", "xmlns:nwd= 'http://schemas.cordys.com/1.0/demo/northwind'");


This results in the following XPath expression:

xpathBusinessObject = ".[nwd:new]/nwd:new/nwd:Employees | .[not(nwd:new)]/nwd:old/nwd:Employees"


If only the old node is available, then the following expression would suffice.

xpathBusinessObject = "nwd:old/nwd:Employees"


Consider the following structure:

<data>
  <project>
    <projectNo>10</projectNo>
    <description>House</description
  </project>
  <project>
<projectNo>20</projectNo>
    <description>Garage</description>
</project>
</data>


ThexpathRowDataand thexpathBusinessObjectrefer to the same node, therefore:

xpathRowData = "data/project"
xpathBusinessObject = "."


In this case, no prefix is needed as no default namespace is supplied.

Example


To view an example depicting the use of thexpathbusinessobjectproperty, see the bindData() method.

See Also


xgrid, xpathRowData, ref, bindData()